import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created whit IntelliJ IDEA.
 * Description：
 * User：ZHONGCHEN
 * Date:2022-03-09
 * Time:12:00
 */
public class TestDemo {
    //幸运的袋子
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] num = new int[n];
        for (int i = 0; i < n; i++) {
            num[i] = scanner.nextInt();
        }
        //升序排序
        Arrays.sort(num);
        System.out.println(dfs(num, 0, 0, 1));
    }

    private static int dfs(int[] num, int curIndex, int sum, int product) {
        int count = 0;
        for (int i = curIndex; i < num.length; i++) {
            sum += num[i];
            product *= num[i];
            if (sum > product) {
                count += 1 + dfs(num, i + 1, sum, product);
            } else if (num[i] == 1) {//如果有多个1，即当k=1时，sum(1)>pi(1)不满足，但下一个元素仍为1，
                // 则可以满足1+1>1*1，所以要判断当前ak是否等于1.
                count += dfs(num,i+1,sum,product);
            }else {
                break;
            }
            //不选num[i]
            sum -= num[i];
            product /= num[i];
            //对于重复数字，要去重复。
            for (;i<num.length-1&&num[i]==num[i+1];i++);
        }
        return count;
    }

    //牛客-计算日期到天数转换
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int year = 0, month = 0, day = 0;
        int[] commonYear = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        while (scanner.hasNext()) {
            year = scanner.nextInt();
            month = scanner.nextInt();
            day = scanner.nextInt();
            int days = 0;
            for (int i = 0; i < month - 1; i++) {
                days += commonYear[i];
            }
            days += day;
            if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {//闰年
                if (month > 2) days++;//月份大于2的再加一天
            }
            System.out.println(days);
        }
    }

    public static void main1(String[] args) {
        int[] nums = {2, 3, 1, 4, 0};
        System.out.println(bestRotation(nums));
    }

    public static int bestRotation(int[] nums) {
        int n = nums.length;
        int[] moves = new int[n + 1];
        for (int step = 0; step < n; step++) {
            if (nums[step] > n - 1)
                continue;
            if (nums[step] >= step) {
                moves[(step + 1) % n]++;
                moves[(n - nums[step] + step + 1) % n]--;
            } else {
                moves[0]++;
                moves[(step - nums[step] + 1) % n]--;
                moves[(step + 1) % n]++;
                moves[n]--;
            }
        }

        int sum = 0;
        int maxSum = 0;
        int ans = 0;
        for (int i = 0; i < n; i++) {
            sum += moves[i];
            if (sum > maxSum) {
                maxSum = sum;
                ans = i;
            }
        }
        return ans;
    }


}
